package com.hedl.practice.diyJava.methodAndStructure.repeat;

public class StudyRepeat {
    public static void main(String[] args) {

        String s ="Teat string";
        int n1 = s.indexOf('t');        //第一个t所在的位置的数组下标
        int n2 = s.indexOf("st");       //st所在的位置的数组下标，注意这里是st中的t结束位置的下标
        int n3 = s.indexOf("st",4);     //fromindex=开始索引的位置，开始搜索；这里4开始是空格

        System.out.println("-->>>>"+n1);
        System.out.println("-->>>>"+n2);
        System.out.println("-->>>>"+n3);


        //练习
        Person p = new Person("小明");
        System.out.println(p);
        System.out.println("===============");
        Person p1 = new Person("张三",12);
        System.out.println(p1);
        System.out.println("===============");
        Person p2 = new Person(35);
        System.out.println(p2);

    }
}
class Person{
    private String name;
    private Integer age;

    public String getName() {
        return name;
    }

    public Integer getAge(){
        return age;
    }
    public void setAge(Integer age){
        this.age = age;
    }
    public void setName(String name) {
        this.name = name;
    }

    public Person(String name){
        this.name = name;
    }
    public Person(String name,Integer age){
        this.name = name;
        this.age = age;
    }
    public Person(Integer age){
        this.age = age;
    }
    public Person(){}
    public String toString(){
        return "输出的信息:"+name+"\n"+"年龄："+age;
    }
}
